@extends('app')


@section('content')
<div class="fly-panel" style="text-align: center">

    <ul class="gzq-list">
        <li class="layui-col-md2 layui-col-sm4 layui-col-xs6">
            <div class="gzq-main" style="cursor: pointer" >
                <div class="gzq-img">
                    <a class="gzq-case-img" onclick="newWindow('图集上传','/images/edit',550,500,true)">
                        <img src="/asset/images/image.png" title="点击上传" alt="点击上传" style="width: 100%; height: auto;">
                    </a>
                </div>
                <div class="gzq-title">
                    <h2><a rel="nofollow">点击上传</a></h2>
                    <p class="gzq-case-desc"><a rel="nofollow">上传图集添加标题、图片、详情等</a></p>
                </div>
            </div>
            <div class="gzq-bar-this"></div>
        </li>
    @foreach($model as $item)
        <li class="layui-col-md2 layui-col-sm4 layui-col-xs6">
            <div class="gzq-main">
                <div class="gzq-img">
                    <a class="gzq-case-img" href="/image/detail/{{ $item->id }}">
                        <img src="{{ $item->cover }}" title="{{ $item->title }}" alt="{{ $item->description }}" style="width: 100%; height: auto;">
                    </a>
                </div>
                <div class="gzq-title">
                    <h2><a href="/image/detail/{{ $item->id }}" rel="nofollow">{{ $item->title }}</a></h2>
                    <p class="gzq-case-desc"><a href="/image/detail/105" rel="nofollow">{{ $item->description }}</a></p>
                </div>
            </div>
            <div class="gzq-bar-this"></div>
        </li>
    @endforeach
    </ul>

    <div id="page"style="clear:both;text-align: center;padding: 20px 0;"></div>
</div>

@endsection

@section('js')
    <script>
    layui.use('laypage', function() {
        var laypage = layui.laypage;

        //执行一个laypage实例
        laypage.render({
            elem: 'page' //注意，这里的 test1 是 ID，不用加 # 号
            , limit:{{$model->perPage()??0}}
            , count: {{$model->total()??0}} //数据总数，从服务端得到
            , curr:{{$model->currentPage()??1}}
            , jump: function (obj, first) {
                // console.log(obj);
                //首次不执行
                if (!first) {
                    window.location.href = "{{URL::current()}}?page=" + obj.curr
                }
            }
        });
    })
    </script>
@endsection